var Human = function (param) {
    // 技能
    this.skill = param && param.skill || '保密';
    //  兴趣
    this.hobby = param && param.hobby || '保密';
}

// 类 人原型方法

Human.prototype = {
    getSkill = function () {
        return this.skill;
    },
    getHobby = function () {
        return this.hobby;
    },
}

// 实例化姓名类
var Named = function (name) {
    var that = this;
    // 构造器函数
    (function (name, that) {
        that.wholeName = name;
        if (name.indexOf(' ') > -1) {
            that.FirstName = name.slice(0, name.indexOf(' '));
            that.secondName = name.slice(name.indexOf(' '));
        }
    })(name, that)
}

// 实例化职位类
var Work = function (work) {
    var that = this;
    // 构造器
    (function (work, that) {
        switch (key) {
            case 'code':
                that.work = '工程师';
                that.workDescript = '每天沉醉于编程';
            case 'UI':
            case 'UE':
                that.work = '设计师';
                that.workDescript = '设计更似一种艺术';
            case 'teach':
                that.work = '教师';
                that.workDescript = '分享也是一种快乐';

            default:
                that.work = work;
                that.workDescript = '不好意思，暂时还不清楚您所选择的相关职位描述'
        }
    })(work, that)
}

// 跟换期望的职位
Work.prototype.changeWork = function (work) {
    this.work = work;
}

// 添加对职位的描述
Work.prototype.changeDescript = function (sentence) {
    this.workDescript = sentence;
}

// 创建一位应聘者
//  应聘建造者
//  参数name : 姓名（全名）
//  参数work： 期望职位

var Person = function (name, work) {
    // 创建应聘者缓存对象
    var _person = new Human();
    _person.name = new Named(name);
    _person.work = new Work(work)
    return _person
}

var person = new Person('xiao ming', 'code');

console.log(person.skill); //保密
console.log(person.name.FirstName); //xiao
console.log(person.work.work); //工程师
console.log(person.work.workDescript); //每天在编程中度过
person.work.changeDescript('更改一下职位描述'); //每天在编程中度过
console.log(person.work.changeDescript); //更改一下职位描述